<?php

namespace api\controller;

// +----------------------------------------------------------------------
// | 菜单路由数据控制层
// +----------------------------------------------------------------------

use common\controller\VerifyController;
use common\service\MenuService;
use think\Request;

class MenuRouteController extends VerifyController
{
    protected $menuService;

    public function __construct()
    {
        parent::__construct();
        $this->menuService = new MenuService();
    }

    /**
     * 更新菜单模块排序索引
     * @param Request $request
     * @return \think\Response
     */
    public function setMenuRouteIndex(Request $request)
    {
        $param = $request->param();
        $resData = $this->menuService->setMenuRouteIndex($param['data']);
        return json(success_response('', $resData));
    }

    /**
     * 获取模块菜单路由
     * @param Request $request
     * @return \think\Response
     */
    public function getRouteList(Request $request)
    {
        $param = $request->param();
        $resData = $this->menuService->getRouteList($param['param']['filter'], $request->getTenantId());
        return json(success_response('', $resData));
    }
}
